package com.winnie.bean;

import lombok.Data;

@Data
public class ResponseEntity {
    Integer code;
    String msg;
    Object data;

    public ResponseEntity() {
    }

    public ResponseEntity(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static ResponseEntity success(String msg) {
        return success(msg, null);
    }

    public static ResponseEntity success(String msg, Object data){
        return success(200,msg,data);
    }

    public static ResponseEntity success(Integer code, String msg, Object data){
        ResponseEntity responseEntity = new ResponseEntity(code,msg,data);
        return responseEntity;
    }

    public static ResponseEntity error(String msg, Object data){
        return error(500,msg,data);
    }
    public static ResponseEntity error(Integer code, String msg, Object data){
        ResponseEntity responseEntity = new ResponseEntity(code,msg,data);
        return responseEntity;
    }


}
